local skel = fk.CreateSkill {
  name = "lb_zero__mengyao_apeika",
}

Fk:loadTranslationTable {
  ["lb_zero__mengyao_apeika"] = "阿佩卡",
  [":lb_zero__mengyao_apeika"] = "当牌对你生效前，你可以弃置X张牌令之对你无效（X为你发动过此技能的次数）。",

  ["#lb_zero__mengyao_apeika"] = "阿佩卡：你可以弃置 %arg 张牌令 %arg2 对你无效",

  ["$lb_zero__mengyao_apeika1"] = "",
  ["$lb_zero__mengyao_apeika2"] = "",
}

skel:addEffect(fk.CardEffecting, {
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and player == target and not player:isNude() 
    and not data.isCancellOut and not data.nullified
    and #player:getCardIds("he") > player:usedSkillTimes(skel.name, Player.HistoryGame) + 1
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local num = player:usedSkillTimes(skel.name, Player.HistoryGame) + 1
    local cards = room:askToDiscard(player, {
      min_num = num,
      max_num = num,
      skill_name = skel.name,
      cancelable = true,
      include_equip = true,
      prompt = "#lb_zero__mengyao_apeika:::" .. num .. ":" .. data.card:toLogString(),
      skip = true,
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function (self, event, target, player, data)
    data.nullified = true
    player.room:throwCard(event:getCostData(self).cards, skel.name, player)
  end,
})

return skel
